<admintpl file="header"/>
<body class="J_scroll_fixed">
<div class="wrap jj">
  <ul class="nav nav-tabs">
     <li><a href="{:U('plugin/index')}">所有插件</a></li>
     <li class="active"><a>插件设置</a></li>
  </ul>
  <div class="common-form">
    <form method="post" class="form-horizontal J_ajaxForm" action="{:U('plugin/setting_post')}">
		<empty name="custom_config">
			<foreach name="data['config']" item="form">
				<div class="control-group">
					<label class="control-label" for="{$key}">
						{$form.title|default=''}
					</label>
					<switch name="form.type">
						<case value="text">
						<div class="controls">
							<input type="text" name="config[{$key}]" class="text input-large" value="{$form.value}" id="{$key}">
							<present name="form.tip">
								<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
						<case value="password">
						<div class="controls">
							<input type="password" name="config[{$key}]" class="text input-large" value="{$form.value}" id="{$key}">
							<present name="form.tip">
								<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
						<case value="hidden">
							<input type="hidden" name="config[{$key}]" value="{$form.value}">
						</case>
						<case value="radio">
						<div class="controls">
							<foreach name="form.options" item="opt" key="opt_k">
								<label class="radio inline">
									<php>$radio_checked=$opt_k==$form['value']?"checked":"";</php>
									<input type="radio" name="config[{$key}]" value="{$opt_k}" {$radio_checked}>{$opt}
								</label>
							</foreach>
							<present name="form.tip">
									<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
						<case value="checkbox">
						<div class="controls">
							<foreach name="form.options" item="opt" key="opt_k">
								<label class="checkbox inline">
									<php>
										is_null($form["value"]) && $form["value"] = array();
									</php>
									<input type="checkbox" name="config[{$key}][]" value="{$opt_k}" <in name="opt_k" value="$form.value"> checked</in>>{$opt}
								</label>
							</foreach>
							<present name="form.tip">
								<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
						<case value="select">
						<div class="controls">
							<select name="config[{$key}]" id="{$key}">
								<foreach name="form.options" item="opt" key="opt_k">
									<option value="{$opt_k}" <eq name="form.value" value="$opt_k"> selected</eq>>{$opt}</option>
								</foreach>
							</select>
							<present name="form.tip">
								<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
						<case value="textarea">
						<div class="controls">
							<textarea name="config[{$key}]" id="{$key}">{$form.value}</textarea>
							<present name="form.tip">
								<span class="help-block">{$form.tip}</span>
							</present>
						</div>
						</case>
					</switch>
				</div>
			</foreach>
		<else />
			<present name="custom_config">
				{$custom_config}
			</present>
		</empty>
		<input type="hidden" name="id" value="{:I('id')}" readonly>
		<div class="form-actions">
            <button type="submit" class="btn btn-primary btn_submit J_ajax_submit_btn">保存</button>
            <a class="btn" href="__URL__">返回</a>
      	</div>
	</form>
  </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>